﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace iBet
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            List<Odd> odds = new List<Odd>();
            
            Odd p1 = new Odd() { Value = Int32.Parse(txtGame1.Text), IsHit = chkGame1.Checked };
            odds.Add(p1);
            p1 = new Odd() { Value = Int32.Parse(txtGame2.Text), IsHit = chkGame2.Checked };
            odds.Add(p1);
            p1 = new Odd() { Value = Int32.Parse(txtGame3.Text), IsHit = chkGame3.Checked };
            odds.Add(p1);
            //p1 = new Odd() { Value = 4, IsHit = true };
            //odds.Add(p1);
            //p1 = new Odd() { Value = 2.0, IsHit = true };
            //odds.Add(p1);
            TicketItem item = new TicketItem() { SystemType = new SystemType() { Min = Int32.Parse(txtMin.Text)  , Max =  Int32.Parse(txtMax.Text) }, Odds = odds };

            Ticket ticket = new Ticket() { Bet = Int32.Parse(txtUplata.Text), Items = new List<TicketItem>() { item } };

            Calculator calculator = new Calculator();
            lblTest.Text = calculator.CalculateTicket(ticket).ToString();
        }
    }
}
